<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
	<table>
   <?php   
  require_once("../conn/conn_db.php");  //包含数据库连接文件 
  if($_GET['O_Num']!= "")
  {
 	$onum = $_GET['O_Num'];  //获取传递的订单编号
 	$sql = "select * from  Order_Info where O_Num='$onum' order by O_CreateTime desc" ;
 	$result = $conn->query($sql); //执行SQL语句
 	$row = $result->fetch_array();  //获取查询结果
 ?>
  <tr><td>订单编号：</td> <td> <?php echo $row["O_Num"];?>  </td></tr>
  <tr><td>商品数量：</td> <td> <?php echo $row["P_Nums"];?> </td></tr>
  <tr><td>订单金额：</td> <td> <?php echo $row["O_Money"];?></td></tr>
  <tr><td>收货人：</td>   <td> <?php echo $row["O_Taker"];?></td></tr>
  <tr><td>收货地址：</td> <td> <?php echo $row["O_Address"];?></td></tr>
  <tr><td>联系电话：</td> <td> <?php echo $row["O_Tel"];?>    </td></tr>
  <tr><td>备注：</td>     <td> <?php echo $row["O_Remark"];?> </td></tr>
  <tr><td>订单日期：</td> <td> <?php echo $row["O_CreateTime"];?></td></tr>
  <tr><td>状态：</td>     <td> <?php echo $row["O_Status"]=='1'? '<font color=blue>已发货</font>':'<font color=red>待发货</font>';?>  </td></tr>
 </table>
 <table>
 <tr>
 <td colspan="7" class="td_head1">订单详细信息 </td></tr>
<tr class="tr_head2">
<td>商品编号</td><td>商品名称</td><td>商品图片</td><td>单价</td><td>数量</td><td>折扣</td><td>小计价格</td></tr>
 <?php
  $sql2 = "select op.*,p.p_name,p.p_image,p.p_id from  Order_Product op, Product_Info p  where op.p_id = p.p_id and O_Num='$onum' order by OP_ID"; 
  $result2 = $conn->query($sql2);              //执行SQL语句
 while($row2 = $result2->fetch_array()) //遍历查询结果的每一行
 {
?>
  <tr>
    <td> <?php echo $row2["p_id"]; ?>  </td>
    <td> <?php echo $row2["p_name"]; ?></td>
    <td> <img src='../<?php echo $row2["p_image"]; ?>' width="50px" height="50px"/>  </td>
    <td> <?php echo $row2["P_UnitPrice"];?>  </td>   
    <td> <?php echo $row2["P_Nums"];?></td>
    <td> <?php echo $row2["P_Flod"];?></td>
    <td> <?php echo $row2["P_Price"];?></td>
  </tr>
<?php
  }  
 }
?>
</table>
</body>
</html>